import React from 'react'
import { Form,Table, Icon, Tag, Modal, Steps, Button, message,Input,Row,Col,Select,DatePicker,InputNumber,Badge } from 'antd'
import moment from 'moment';
import { METHODS } from 'http';
const Step = Steps.Step;
const confirm = Modal.confirm
const FormItem = Form.Item;
const Option = Select.Option;

class ChangeList extends React.Component {
    constructor(props){
        super(props);
        this.state = {

        };
    }
    async pageChange(pagination) {
	    await this.props.onPageChange(pagination);
	    this.newPage = pagination.current;
  }
  goHistory = e => {
    const {goHistory1} = this.props
    goHistory1(e)
  }
    render(){
        const { list,loading,pagination1 } = this.props
        const columns = [
          {
            title: "申请人",
            dataIndex: "applyName",
            key: "applyName",
            render: (text, record) => {
              const datas = text.split("#")
              const ary = []
              datas.map((item, i) => {
                ary.push(
                  <p>{item}</p>
                )
              })
              return ary
            }
          },
          {
            title: "身份证号码",
            dataIndex: "idcard",
            key: "idcard",
            render: (text, record) => {
              if(!text){
                return null
              }
              const datas = text.split("#")
              const ary = []
              datas.map((item, i) => {
                ary.push(
                  <p>{item}</p>
                )
              })
              return ary
            }
          },
          {
            title: "公证事项",
            dataIndex: "notarialMatters",
            key: "notarialMatters",
            render: (text, record) => {
              if(!text){
                return null
              }
              const datas = text.split("#")
              const ary = []
              datas.map((item, i) => {
                ary.push(
                  <p>{item}</p>
                )
              })
              return ary
            }
          },{
            title: "公证号码",
            dataIndex: "notaryNumber",
            key: "notaryNumber",
            render: (text, record) => {
              const datas = text.split("#")
              const ary = []
              datas.map((item, i) => {
                ary.push(
                  <p>{item}</p>
                )
              })
              return ary
            }
          },
          {
            title: "承办人",
            dataIndex: "contractorUserName",
            key: "contractorUserName",
          }, {
            title: "建档人",
            dataIndex: "createdUserName",
            key: "createdUserName",
          },
          {
            title: "收件日期",
            dataIndex: "createdTime",
            key: "createdTime",
            render: (text, record) => {
              return (
                <p>
                  {
                    moment(record.createdTime).format("YYYY-MM-DD")
                  }
                </p>
              )
            }
          },
          {
            title: "公证日期",
            dataIndex: "notarizationAt",
            key: "notarizationAt",
            render: (text, record) => {
              return (
                <p>
                  {
                    moment(record.notarizationAt).format("YYYY-MM-DD")
                  }
                </p>
              )
            }
          },
          {
            title: "承办人",
            dataIndex: "contractorUserName",
            key: "contractorUserName",
          },
          {
            title: "建档人",
            dataIndex: "createdUserName",
            key: "createdUserName",
          },
          {
            title: "所属机构",
            dataIndex: "organizationName",
            key: "organizationName",
          },
            ,{
              title: '操作',
              dataIndex:'operation',
              key: 'operation',
              render:(text,record) =>{
                      return(
                          <div>
                             <span  onClick={this.goHistory.bind(null,record)} style={{marginRight:5}}><a href="#">查看历史变更</a></span>
                          </div>
                      )
              }
        } 
       ];
        return(
            <Table
                columns={columns}
                dataSource={list}
                loading={loading}
                onChange={this.pageChange.bind(this)}
                pagination={pagination1}
            />
        )
    }
}

export default ChangeList